package com.itheima;

import com.itheima.dao.BookDao;
import com.itheima.pojo.Clazz;
import com.itheima.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App2 {
    public static void main(String[] args) {
        //3.获取IoC容器
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        //4.获取bean（根据bean配置id获取）
//        BookDao bookDao = (BookDao) ctx.getBean("bookDao");
//        bookDao.save();

//        BookService bookService = (BookService) ctx.getBean("bookService");
//        bookService.save();
        Clazz clazz = ctx.getBean("clazz3", Clazz.class);
        Clazz clazz2 = ctx.getBean("clazz", Clazz.class);
        System.out.println(clazz==clazz2);

    }
}
